package com.mlethe.library.multi.api.entity;

import android.text.TextUtils;

import com.mlethe.library.multi.api.Share;

/**
 * 小程序分享实体(仅支持微信、QQ)
 *
 * @author Mlethe
 */
public final class ShareMini extends Share {
    /**
     * 小程序的原始id，示例：gh_d43f693ca31f
     */
    private String userName;
    /**
     * 小程序的path
     */
    private String path;

    /**
     * @param userName 小程序原始id
     * @param path     小程序页面路径
     */
    public ShareMini(String userName, String path) {
        this.userName = userName;
        this.path = path;
    }

    /**
     * @param userName  小程序原始id
     * @param path      小程序页面路径
     * @param targetUrl QQ：点击跳转的页面
     */
    public ShareMini(String userName, String path, String targetUrl) {
        this.userName = userName;
        this.path = path;
        setTargetUrl(targetUrl);
    }

    /**
     * 获取小程序的原始id
     */
    public String getUserName() {
        return userName;
    }

    /**
     * 获取小程序的path，示例：gh_d43f693ca31f
     */
    public String getPath() {
        return path;
    }

    @Override
    public boolean isValid() {
        return !TextUtils.isEmpty(userName) && !TextUtils.isEmpty(path);
    }

    @Override
    protected void release() {
        super.release();
        userName = null;
        path = null;
    }
}
